import { ApiProperty } from '@nestjs/swagger';
import { IsString, MinLength, MaxLength } from 'class-validator';
import type { IChangePassword } from '@nbase/shared';

/**
 * 修改密码 DTO
 */
export class ChangePasswordDto implements IChangePassword {
  @ApiProperty({
    description: '旧密码',
    example: 'oldPassword123',
    minLength: 6,
    maxLength: 50,
  })
  @IsString()
  @MinLength(6, { message: '旧密码长度不能小于 6 位' })
  @MaxLength(50, { message: '旧密码长度不能大于 50 位' })
  oldPassword!: string;

  @ApiProperty({
    description: '新密码',
    example: 'newPassword123',
    minLength: 6,
    maxLength: 50,
  })
  @IsString()
  @MinLength(6, { message: '新密码长度不能小于 6 位' })
  @MaxLength(50, { message: '新密码长度不能大于 50 位' })
  newPassword!: string;
}

